<?php
/*
 * Define todas as constantes
 * Realiza todo o código de configuração
 * Inclui os arquivos padrao
 */

/**
 * Contains path for base site directory
 */
define('BASE_DIR', dirname(__FILE__) . '/');

/**
 * Contains path for base api directory
 */
define('API_DIR', BASE_DIR . 'api/');

/**
 * Contais URL to load root page
 */
define('BASE_URL', '/perolas/');

//Set path
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . BASE_DIR);

//Define default page
if (empty($_GET['_page'])) {
    $_GET['_page'] = 'main';
}

//Require
require_once ('api/Page.php');

//Criando a sessao
session_start();

/**
 * Return the name of file to load
 * @return string
 */
function getFileName() {
    return 'pages/' . $_GET['_page'] . '.php';
}